package amqp.tutorials.all.direct;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class DirectSender {

    @Autowired
    private RabbitTemplate rabbitTemplate;


    private static final String[] logs = new String[]{"error", "info", "warning"};

    public void send(String msg) {

        for (String s : logs) {
            rabbitTemplate.convertAndSend("DirectExchange", s, msg);
        }


    }
}
